package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.SysCodingRuleMapper;
import com.ruoyi.system.domain.SysCodingRule;
import com.ruoyi.system.service.ISysCodingRuleService;

/**
 * 编码规则配置Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-08-08
 */
@Service
public class SysCodingRuleServiceImpl implements ISysCodingRuleService 
{
    @Autowired
    private SysCodingRuleMapper sysCodingRuleMapper;

    /**
     * 查询编码规则配置
     * 
     * @param ruleId 编码规则配置主键
     * @return 编码规则配置
     */
    @Override
    public SysCodingRule selectSysCodingRuleByRuleId(Long ruleId)
    {
        return sysCodingRuleMapper.selectSysCodingRuleByRuleId(ruleId);
    }

    /**
     * 查询编码规则配置列表
     * 
     * @param sysCodingRule 编码规则配置
     * @return 编码规则配置
     */
    @Override
    public List<SysCodingRule> selectSysCodingRuleList(SysCodingRule sysCodingRule)
    {
        return sysCodingRuleMapper.selectSysCodingRuleList(sysCodingRule);
    }

    /**
     * 新增编码规则配置
     * 
     * @param sysCodingRule 编码规则配置
     * @return 结果
     */
    @Override
    public int insertSysCodingRule(SysCodingRule sysCodingRule)
    {
        sysCodingRule.setCreateTime(DateUtils.getNowDate());
        return sysCodingRuleMapper.insertSysCodingRule(sysCodingRule);
    }

    /**
     * 修改编码规则配置
     * 
     * @param sysCodingRule 编码规则配置
     * @return 结果
     */
    @Override
    public int updateSysCodingRule(SysCodingRule sysCodingRule)
    {
        sysCodingRule.setUpdateTime(DateUtils.getNowDate());
        return sysCodingRuleMapper.updateSysCodingRule(sysCodingRule);
    }

    /**
     * 批量删除编码规则配置
     * 
     * @param ruleIds 需要删除的编码规则配置主键
     * @return 结果
     */
    @Override
    public int deleteSysCodingRuleByRuleIds(Long[] ruleIds)
    {
        return sysCodingRuleMapper.deleteSysCodingRuleByRuleIds(ruleIds);
    }

    /**
     * 删除编码规则配置信息
     * 
     * @param ruleId 编码规则配置主键
     * @return 结果
     */
    @Override
    public int deleteSysCodingRuleByRuleId(Long ruleId)
    {
        return sysCodingRuleMapper.deleteSysCodingRuleByRuleId(ruleId);
    }
}
